package offer;

/**
 * @Author SSK
 * @Date Created in 18:25 2019/8/4
 * @Description 翻转单词顺序列
 * @Version 1.0
 */
public class T45 {
    public String ReverseSentence(String str) {
        String s[] = str.split(" ");
        if (s.length==0) {
            return str;
        }
        String str1 = s[s.length-1];
        for (int i = s.length-2; i >=0; i--) {
            str1 += " "+s[i];
        }
        return str1;
    }
}
